home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_aet_mardukbutton.cog < prev    next >
Text File  |  1999-11-15  |  5KB  |  217 lines

  1. # Jones 3D Cog Script
  2. #
  3. # aet_MardukButton.cog
  4. #
  5. # [TL & revised by HB]
  6. #
  7. # (C) 1999 LucasArts Entertainment Co. All Rights Reserved
  8. # ==============================================================================
  9.  
  10. symbols
  11.     
  12. message     startup
  13. message        activated
  14. message        arrived
  15.  
  16. sound        placeGem=aet_gem_place.wav        local    # Gem placement sound    
  17. sound        used_thing=at02j03.wav            local    # "...used this thing to charge his..."
  18. sound        whip=INXJ020.wav                local    # "I might be able to whip that thing..."    
  19. sound        probestart=aet_probe_start.wav    local
  20. sound        probestop=aet_probe_stop.wav    local
  21. sound        probemove=aet_probe_move.wav    local
  22.  
  23. sound        in_switch=Inxj050.wav            local    # could be switch
  24. sound        in_keyhole=Inxj082.wav            local    # need key
  25.  
  26. thing        player                            local
  27. thing        indy                                    # Actor Indy
  28.  
  29. thing        cam0                            nolink    # Camera 
  30. thing        probecam                        nolink
  31. thing        probetarg                        nolink
  32. thing        m_cam1spot                        nolink
  33. thing        m_cam1look                        nolink
  34. thing        m_in_mk_1                        nolink # where player ends up
  35.                             
  36. thing        buttonA                                    # Button with no gem
  37. thing        buttonB                                    # Button with gem
  38. thing        probe                                    # Probe for whip
  39. thing        long_probe    
  40.  
  41. cog            doortalkcog                                            
  42.  
  43. flex        viewangle                        local
  44.  
  45. int            cursound                        local
  46. int            done0=0                            local
  47. int            curcam                            local
  48. int            curitem                            local
  49. int            sayline                            local
  50.  
  51. end
  52.  
  53. # ==============================================================================
  54.  
  55. code
  56.  
  57. startup:
  58.  
  59.     player = GetLocalPlayerThing();
  60.     SetThingFlags(buttonB, 0x80000);
  61.  
  62.     AttachThingToThingEx(long_probe, probe, 0x000C);        
  63.     
  64.     global10 = 0; # <---INIT GLOBAL VAR
  65.  
  66.     return;
  67.  
  68. # ..............................................................................
  69.  
  70. activated:
  71.  
  72.     # Using Marduk's Medallion to lower probe...
  73.  
  74.     if ((GetSenderRef() == buttonA) && (GetSourceRef() == player))
  75.     {
  76.         if (done0 != 0) 
  77.         {
  78.             return;
  79.         }
  80.  
  81.         curitem = GetCurItem(player);
  82.         
  83.         if (curitem == 0)
  84.         {
  85.             # no item...
  86.             MakeMeStop();
  87.             DeselectWeaponWait(player);
  88.             StartCutscene(0);
  89.             SetExtCamOffsetToThing(1, cam0);
  90.             sayline = RandBetween(0, 1);
  91.             if (sayline == 0)
  92.             {
  93.                 PlayVoice(player, in_switch, 1.0, 1);
  94.             }
  95.             else
  96.             {
  97.                 PlayVoice(player, in_keyhole, 1.0, 1);
  98.             }
  99.  
  100.             RestoreExtCam();
  101.             EndCutscene();  
  102.             ClearActorFlags(player, 0x200000);
  103.         }
  104.  
  105.         if ((curitem != 111) && (curitem != 0))
  106.         {
  107.             # Trying wrong items...
  108.  
  109.             MakeMeStop();
  110.             DeselectWeaponWait(player);
  111.             StartCutscene(0);
  112.             PlayMode(player, 60, 0);
  113.  
  114.             global15 = 0;
  115.             SendMessageEx(doortalkcog, user3, player, 0, 0, 0);
  116.             while (global15 == 0)
  117.             {
  118.                 # Wait for line to finish...
  119.                 Sleep(0.01);
  120.             }
  121.             EndCutscene();  
  122.             ClearActorFlags(player, 0x200000);
  123.         }
  124.  
  125.         if (GetCurItem(player) == 111)
  126.         {
  127.             done0 = 1;
  128.  
  129.             # Using Marduk medallion...
  130.  
  131.             MakeMeStop();
  132.             DeselectWeaponWait(player);
  133.             StartCutScene(1);
  134.             Sleep(0.01);
  135.  
  136.             # Show placing gem...
  137.             MakeCamera2LikeCamera1(m_cam1spot, m_cam1look);
  138.             SetCameraLookInterp(2, 0);
  139.             SetCameraPosInterp(2, 0);
  140.             SetCameraFocus(2, m_cam1spot);
  141.             SetCameraSecondaryFocus(2, m_cam1look);
  142.  
  143.             viewangle = GetCameraFOV();
  144.             SetCurrentCamera(2);
  145.             ResetCameraFOV(0, 0.0); # added 10/21/99 HB
  146.             SetCameraLookInterp(2, 1);
  147.             SetCameraPosInterp(2, 1);
  148.             SetCameraInterpSpeed(2, 0.7);
  149.             Sleep(0.01);
  150.             SetCameraFocus(2, cam0);
  151.             SetCameraSecondaryFocus(2, buttonB);
  152.                     
  153.             # Make button with gem visible...
  154.             SetThingFlags(buttonA, 0x80000);
  155.             ClearThingFlags(buttonB, 0x80000);
  156.             PlaySoundThing(placeGem, buttonB, 1.0, -1, -1, 0);
  157.             ChangeInv(player, 111, -1);
  158.             PlayMode(player, 60, 0);    
  159.             Sleep(0.3);
  160.             MoveToFrame(buttonB, 1, 1.0);
  161.             MoveToFrame(probe, 1, 4.0); # long trip, start early
  162.             Sleep(1.5);
  163.  
  164.             # Pan & Tilt to probe...
  165.             SetCameraInterpSpeed(2, 1.5);
  166.             Sleep(0.01);
  167.             SetCameraFocus(2, probecam);
  168.             SetCameraSecondaryFocus(2, probetarg);
  169.  
  170.             PlaySoundLocal(probestart, 1.0, 0, 0x0, 0);
  171.             cursound = PlaySoundLocal(probemove, 1.0, 0, 0x1, 0);
  172.  
  173.             # Continued in arrived...
  174.         }
  175.     }
  176.  
  177.     return;
  178.  
  179. # ..............................................................................
  180.  
  181. arrived:
  182.  
  183.     if ((GetSenderRef() == probe) && (GetCurFrame(probe) == 1) && (done0 == 1))
  184.     {
  185.         StopSound(cursound, 0.0);
  186.         PlaySoundLocal(probestop, 1.0, 0, 0x0, 0);
  187.         Sleep(1.0);
  188.  
  189.         if (global10 == 0)
  190.         {
  191.             # Indy hasn't noticed charging yet...
  192.             PlayVoice(player, used_thing, 1.0, 1);
  193.         }
  194.         else
  195.         {
  196.             # Indy has already noticed...
  197.             PlayVoice(player, whip, 1.0, 1);
  198.         }
  199.         global10 = 1;
  200.         
  201.         # Back to play...
  202.         SetCameraLookInterp(2, 0);
  203.         SetCameraPosInterp(2, 0);
  204.         TeleportThing(player, m_in_mk_1);
  205.         SetCameraPosition(1, GetThingPos(probecam));
  206.         SetCurrentCamera(1);
  207.         ResetCameraFOV(0, 0.0);    
  208.  
  209.         EndCutScene();
  210.         ClearActorFlags(player, 0x200000);
  211.     }
  212.  
  213.     return;
  214.  
  215. end
  216.  
  217.